package main

import (
	"fmt"
	"strconv"
)

/*
=========================map的基本语法===============================
var map变量名 map[keyType]valueType

e:
var a map[string]string
var a map[string]map[string]string
声明不会分配内存，初始化需要make，分配内存后才能赋值和使用


*/

func main() {
	/*var nameMap map[string]string
	nameMap = make(map[string]string, 10)*/

	/*nameMap :=  make(map[string]string, 10)

	nameMap["A"] = "tomy"
	nameMap["B"] = "jerrry"
	*/

	nameMap := map[string]string{
		"A": "jo",
		"B": "kq",
	}

	nameMap["C"] = "NC"
	fmt.Println(nameMap)

	delete(nameMap, "C")
	fmt.Println(nameMap)

	for i := 0; i < 10; i ++{
		nameMap[strconv.Itoa(i)] = strconv.Itoa(i) + " -- "
	}

	for k,v := range nameMap{
		fmt.Printf("k = %v, v = %v \n", k, v)
	}
}
